package org.example;

import java.sql.*;

public class ConnectDatabase {
    public Connection con;
    public ConnectDatabase(){

        try{Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
        }
        catch(Exception e){
            System.out.println("未成功链接数据库驱动");
        }
        try{ //创建名为UserList的数据库：
            String uri = "jdbc:derby:UserList;create=false";
            con = DriverManager.getConnection(uri); //链接数据库
        } catch (SQLException e) {
            System.out.println("lianjieshuibai");
        }
    }
}
